word    ctlCount[] =   { 0, 8, 9, 6, 22, 6, 17};
handle  ctls[22];
word    CtlArray[7][22] = {

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0x1130, 0x1140, 0x1150, 0x1160, 0x1170, 0x1180, 0x1190, 0x11A0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0x1230, 0x1240, 0x1245, 0x1250, 0x1260, 0x1270, 0x1280, 0x1290, 0x12A0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0x1310, 0x1320, 0x1325, 0x1330, 0x1340, 0x1350,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0x1430, 0x1431, 0x1432, 0x1433, 0x1434, 0x1435, 0x1436, 0x1437,
0x1440, 0x1441, 0x1442, 0x1443, 0x1444, 0x1445, 0x1446, 0x1447,
0x1450, 0x1460, 0x1470, 0x1480, 0x1490, 0x14A0},

{0x1530, 0x1540, 0x1550, 0x1560, 0x1570, 0x1580,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0x1620, 0x1630, 0x1631, 0x1632, 0x1633, 0x1634, 0x1635, 0x1636, 0x1637,
0x1644, 0x1645, 0x1646, 0x1647, 0x1650, 0x1660, 0x1670, 0x1680,
0, 0, 0, 0, 0}  };


long setMatchFlags(long MatchFlags, Handle ctlH, long mask)
{
    if (GetCtlValue(ctlH))
        return MatchFlags |= mask;
    else
        return MatchFlags &= (0xFFFFFFFFL ^= mask);
}


void SwapCtls (word oldGroup, word newGroup, GrafPortPtr winP)
{
handle  temp;

    if (oldGroup != newGroup) {
        for (j = 0; j < ctlCount[oldGroup]; j++) {
            DisposeControl(ctls[j]);
        }
        for (j = 0; j < ctlCount[newGroup]; j++) {
            temp = loadEdRes(CtlArray[newGroup][j], rControlTemplate);
            ctls[j] = NewControl2(winP, 1, temp);
        }
    }
}

char    tempStr[256];

void StoreCtls(word Group, GrafPortPtr winP, OneDocDataPtr theDoc)
{
word    tVal;
long    lSize, hSize;

    switch (Group) {
        case 1:
            GetLETextByID(winP, 0x1130L, tempStr);
            theDoc->fileType = Dec2Int(&tempStr[1], (word) tempStr[0], 1);
            GetLETextByID(winP, 0x1140L, tempStr);
            theDoc->auxType = Dec2Long(&tempStr[1], (word) tempStr[0], 1);
            GetLETextByID(winP, 0x1150L, tempStr);
            theDoc->auxMask = Dec2Long(&tempStr[1], (word) tempStr[0], 1);

            theDoc->matchFlags = setMatchFlags(theDoc->matchFlags, ctls[6], 0x00000001L);
            theDoc->matchFlags = setMatchFlags(theDoc->matchFlags, ctls[7], 0x00000002L);

            break;

        case 2:
            GetLETextByID(winP, 0x1130L, tempStr);
            lSize = (long) tempStr[0] + 1;
            if (tempStr[0] == 0) {
                if (theDoc->fileNameHndl)
                    DisposeHandle(theDoc->fileNameHndl);
                theDoc->fileNameHndl = 0L;
            }
            else {
                if (!theDoc->fileNameHndl)
                    theDoc->fileNameHndl = NewHandle(lSize, fUserID, 0x8018, 0L);
                hSize = GetHandleSize(theDoc->fileNameHndl);
                if (hSize != lSize) {
                    HUnlock(theDoc->fileNameHndl);
    	            SetHandleSize(lSize, theDoc->fileNameHndl);
                }
                BlockMove(tempStr, *theDoc->fileNameHndl, lSize);
            }

            GetLETextByID(winP, 0x1240L, tempStr);
            theDoc->eof = Dec2Long(&tempStr[1], (word) tempStr[0], 1);
            theDoc->eofCompSpec = (GetCtlValue(ctls[2]) - 0x1301);

            tVal = GetCtlValue(ctls[3]);
            theDoc->extMask = 0x8000;
            theDoc->compareValue = tVal ? 0x8000 : 0x0000;

            theDoc->matchFlags = setMatchFlags(theDoc->matchFlags, ctls[6], 0x00000080L);
            theDoc->matchFlags = setMatchFlags(theDoc->matchFlags, ctls[7], 0x00000800L);
            theDoc->matchFlags = setMatchFlags(theDoc->matchFlags, ctls[8], 0x00000004L);
            break;

        case 3:

            theDoc->CcompareSpec = (GetCtlValue(ctls[0]) - 0x1301);
            theDoc->CcompareSpec = (GetCtlValue(ctls[1]) - 0x1311);

            theDoc->CtimeRec[0] =


struct timeData {				/* size = 8 bytes */
	char		timebytes[8];
	};
typedef struct timeData timeData, *timeDataPtr, **timeDataHndl;

struct TimeRec {
   Byte second;
   Byte minute;
   Byte hour;
   Byte year;
   Byte day;
   Byte month;
   Byte extra;
   Byte weekDay;
} ;
typedef struct TimeRec TimeRec, *TimeRecPtr, **TimeRecHndl;


	word			CcompareSpec;		/* matchCreateDateTime */
	word			McompareSpec;		/* matchModDateTime */


Group III - Dates                           6
1310 Create Date <=>        Popup
1320 ModDate <=>            Popup
1325 Create Date            Murph
1330 Mod Date               Murph
1340 Create Date            Active CheckBox
1350 Mod Date               Active CheckBox

	word			CcompareSpec;		/* matchCreateDateTime */
	timeData		CtimeRec;			/* matchCreateDateTime */
	word			McompareSpec;		/* matchModDateTime */
	timeData		MtimeRec;			/* matchModDateTime */



Bit     HexEq     Field
 0 -    0x0001   fileType
 1 -    0x0002   auxType
 2 -    0x0004   fileName
 3 -    0x0008   creation date
 4 -    0x0010   mod date
 5 -    0x0020   local access
 6 -    0x0040   net access
 7 -    0x0080   extended files
 8 -    0x0100   HFS Filetype
 9 -    0x0200   HFS Creator
10 -    0x0400   Option List
11 -    0x0800   EOF





    }
}







#include "types.rez"
1000-   Base Popup- which match

Group I - File Type/AuxType                 8
1130 FileType               LE
1140 AuxType                LE
1150 AuxType Mask           LE
1160 FileType               Label
1170 AuxType                Label
1180 AuxType Mask           Label
1190 FileType Match         Active CheckBox
11A0 AuxType Match          Active CheckBox

Group II - File Attributes                  8
1230 Filename               LE
1240 EOF                    LE
1250 Extended File          CheckBox
1260 Filename               Label
1270 EOF                    Label
1280 Extended File Match    Active CheckBox
1290 EOF Match              Active CheckBox
12A0 Filename Match         Active CheckBox

	handle		    fileNameHndl;		/* matchFileName */
	word			extMask;			/* matchExtended */
	word			compareValue;		/* matchExtended */
	word			eofCompSpec;		/* match EOF */
	long			eof;				/* match EOF */



Group III - Dates                           6
1310 Create Date <=>        Popup
1320 ModDate <=>            Popup
1325 Create Date            Murph
1330 Mod Date               Murph
1340 Create Date            Active CheckBox
1350 Mod Date               Active CheckBox

	word			CcompareSpec;		/* matchCreateDateTime */
	timeData		CtimeRec;			/* matchCreateDateTime */
	word			McompareSpec;		/* matchModDateTime */
	timeData		MtimeRec;			/* matchModDateTime */



Group IV -  Local Access                    22
1430 Destroy Set            CheckBox
1431 Destroy Test           CheckBox
1432 Rename Set             CheckBox
1433 Rename Test            CheckBox
1434 Backup Set             CheckBox
1435 Backup Test            CheckBox
1436 Set                    Label
1437 Test                   Label
1440 Invisible Set          CheckBox
1441 Invisible Test         CheckBox
1442 Write Set              CheckBox
1443 Write Test             CheckBox
1444 Read Set               CheckBox
1445 Read Test              CheckBox
1446 Set                    Label
1447 Test                   Label
1450 Destroy                Label
1460 Rename                 Label
1470 Backup                 Label
1480 Invisible              Label
1490 Write                  Label
14A0 Read                   Label

	word			LAmask;			    /* matchLocalAccess */
	word			LAvalue;			/* matchLocalAccess */




Group V -   HFS FileType/Creator            6
1530 HFS FileType           LE
1540 HFS Creator            LE
1550 FileType               Label
1560 Creator                Label
1570 FileType               Active CheckBox
1580 Creator                Active CheckBox
	long			HFSfileType;		/* matchHFSFileType */
	long			HFScreator;			/* matchHFSCreator */

Group VI -  Network Access                  17
1620 Class Type             PopUp
1630 Changes Set            CheckBox
1631 Changes Test           CheckBox
1632 Files Set              CheckBox
1633 Files Test             CheckBox
1634 Folders Set            CheckBox
1635 Folders Test           CheckBox
1636 Set                    Label
1637 Test                   Label
1644 Owner Set              CheckBox
1645 Owner Test             CheckBox
1646 Set                    Label
1647 Test                   Label
1650 Changes                Label
1660 Files                  Label
1670 Folders                Label
1680 Is Owner               Label

	long			NAmask;			    /* matchNetworkAccess */
	long			NAvalue;			/* matchNetworkAccess */



long SetMatchFlags (word true, word position
